let path = require("path");
let sequelize = require('../config/sequelize');

const modelName = path.basename(__filename, '.js');

const model = sequelize.define(modelName, {

  id: {
    type: sequelize.Sequelize.INTEGER,
    primaryKey: true,
    autoIncrement: true,
    comment: '自增ID'
  },

  hash: {
    type: sequelize.Sequelize.STRING,
    comment: '文件hash'
  },

  size: {
    type: sequelize.Sequelize.BIGINT,
    comment: '文件大小，单位B'
  },

  count: {
    type: sequelize.Sequelize.INTEGER,
    comment: '文件引用计数'
  },

  location: {
    type: sequelize.Sequelize.TEXT,
    comment: '文件在磁盘上的存放路径',
    defaultValue: '/'
  },

}, {
    underscored: true,
    freezeTableName: true,
    paranoid: true
  });

module.exports = model;
